<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<script src="${pageContext.request.contextPath}/js/jquery-3.3.1.min.js"></script>
<SCRIPT type="text/javascript">
	var flag=false ;
		$(function(){
			$("#yanzhengma").blur(function(){
				$.ajax({
					type:"get",
					url:"checkName.do",
					async:true,
					data:{
						"yanzhenma":$("#yanzhengma").val()
					},
					success:function(results){
						//alert(results+"1");
						if($.isEmptyObject(results)){
							$("#info").html("<font color='red'>验证码错误</font>");
							flag =false;
						}else{
							$("#info").html("<font color='blue'></font>");
							flag =true;
						}
					}
				});
			});
		});
		function callback(data){     
		    $("#info").html(data);     
		} 
		function refresh(){
			window.location.reload(true);
		}
		
		//验证码登录判断
		function returnResults(){
			 if(flag==false){
			 	return false;
			 }else{
			 	return true;
			 }
		}
		 
		
	</SCRIPT>
	<head>
		<meta charset="UTF-8">
        <meta name="author" content="order by dede58.com"/>
		<title>会员登录</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/login.css">
		<script src="${pageContext.request.contextPath}/js/jquery-3.3.1.min.js"></script>
		<script src="${pageContext.request.contextPath}/js/xiangqing.js" type="text/javascript" charset="utf-8">
		</script>
	</head>
	<body>
		<!-- login -->
		<div class="top center">
			<div class="logo center">
				<a href="${pageContext.request.contextPath}/User/toHome.do" target="_blank"><img src="${pageContext.request.contextPath }/image/taobook.png" alt=""></a>
			</div>
		</div>
		<form  method="post" action="${pageContext.request.contextPath}/User/login.do" class="form center" method="post" onsubmit="return returnResults()">
		<div class="login">
			<div class="login_center">
				<div class="login_top">
					<div class="left fl">会员登录</div>
					<div class="right fr">您还不是我们的会员？<a href="${pageContext.request.contextPath}/User/toReg.do" target="_self">立即注册</a></div>
					<div class="clear"></div>
					<div class="xian center"></div>
				</div>
				<div class="login_main center">
					<div class="username">用户名:&nbsp;<input id="un" class="shurukuang" type="text" name="userName" placeholder="请输入你的用户名"/></div><DIV id="uname"></DIV>
					<div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;<input id="ps" class="shurukuang" type="password" name="userPass" placeholder="请输入你的密码"/></div>
					<div class="username">
						<div class="left fl">验证码:&nbsp;<input id="yanzhengma" class="yanzhengma" type="text" name="username" placeholder="请输入验证码"/></div>
						<div class="right fl">
							 <img id="imgObj"  alt="" src="${pageContext.request.contextPath}/ImageRand"/>
							 <a href="javascript:refresh()">换一张</a>       
        						<div id="info"></div>
						</div>
					</div>
				</div>
				<div class="login_submit">
					<input class="submit" type="submit" name="submit" value="立即登录" >
				</div>
				
			</div>
		</div>
		</form>
		<footer>
			<div class="copyright">简体 | 繁体 | English | 常见问题</div>
			<div class="copyright">TAOBOOK公司版权所有-京ICP备10046444-<img src="${pageContext.request.contextPath }/image/ghs.png" alt="">京公网安备11010802020134号-京ICP证110507号</div>

		</footer>
	</body>
</html>